﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Accountant
{
    public partial class accept_Open_Save_Fees : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = int.Parse(Request.Form["id"]);
            int cls = int.Parse(Request.Form["cls"]);
            string date = Request.Form["date"];
            
            var get_sf = new TblStudySaveFeeController().FetchAll().Where(x => x.UserId == id).Single();

            var get_last_bill = new TblStudyFeeController().FetchAll().Where(x => x.UserId == id).Last();
            new TblStudyFeeController().Update(get_last_bill.Id, null, null, null, null, DateTime.Parse(date), null, null, int.Parse(Session["admin_id"].ToString()));
            new TblStudySaveFeeController().Destroy(get_sf.Id);
            new TblUserController().Update(id, null, null, null, null, null, null, null, null, null, null, null, null, null, cls, null, null, null, null);
        }
    }
}